package com.xue.action.sys;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.PageInfo;
import com.xue.common.vo.ParamMap;
import com.xue.pojo.sys.SysRole;
import com.xue.service.sys.ISysRoleService;

//2018-12-28 15:54:20
@RequestMapping(value = SysRoleController.PATH)
@RestController("SysRoleController")
public class SysRoleController {
	private static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(SysRoleController.class);
	public static final String PATH = "sys/sysrole";
	public static final String defaultPermissionGroup = PATH + "/list.html";// 默认权限组

	@Autowired
	private ISysRoleService service;

	/* 分页查询 */
	@PostMapping("/listPage")
	public PageInfo<SysRole> listPage(@RequestBody ParamMap pm) {
		PageInfo<SysRole> page = service.queryByPage(pm);
		return page;
	}

	/* 按id查询 */
	@PostMapping("/getById")
	public SysRole getById(@RequestBody ParamMap pm) {
		return service.queryById(pm.getS("id"));
	}

	/* 保存 */
	@PostMapping("/add")
	public Integer add(@RequestBody SysRole vo) {
		return service.save(vo);
	}

	/* 更新 */
	@PostMapping("/update")
	public Integer update(@RequestBody SysRole vo) {
		return service.update(vo);
	}

	/* 删除 */
	@PostMapping("/deleteByIds")
	public Integer deleteByIds(@RequestBody List<String> ids) {
		return service.deleteByIds(ids);
	}
}